setGlobalDuration(30)

example = 3

env = genLineseg([0,10,1,25,.25,100,0])
wa = genWaveform()

pitchs = chord('Cm7', octave=10)
trpitchs = chord('Cm7', octave=4, format='hertz')

if example == 1:
    beginLoop(amplitude=[1,.05])
    waveform(pitch=pitchs, amplitude=.5, table=wa, duration=[.4,.6,.8,1], envelope=env)
    endLoop()

elif example == 2:
    beginLoop(legato=[.5,2])
    pluckedString(pitch=trpitchs, amplitude=.5, cutoff=[1000,2000,3000,4000], duration=[1,.75,.5,.25])
    endLoop()

elif example == 3:
    beginLoop(legato=[1,.75], amplitude=[1,0])
    readTable(bus=[1,2,3,4], table=env, duration=[.12,.24,.36,.48])
    freqMod(pitch=[803,602,401,200], amplitude=.7, duration=[.5,.75], modulator=.49, index=10, amplitudeVar=[1,2,3,4], indexVar=[1,2,3,4], out='fm')
    endLoop()

    lfo(bus='lfo', frequency=.1, amplitude=1, offset=1.25)
    bandpass(input='fm', cutoff=800, bandwidth=300, cutoffVar='lfo', bandwidthVar='lfo')

startCsound()